/**
 * Copyright(C),2015 misaka15842
 * @author misaka15842 (misakamoe@yahoo.com)
 *
 * RenderableElement 逻辑渲染单元。每个渲染单元都是一个矩形，
 * 可控制alpha属性，priority属性决定渲染单元渲染的顺序，
 * priority越小优先级越高。排序方式必须是stable sort。
 */

#ifndef RENDERABLEELEMENT_H_
#define RENDERABLEELEMENT_H_

#include "Draw.h"
#include "BaseRenderer.h"
#include "ITexture.h"

namespace misaka
{
    class RenderableElement
    {
        protected:
            uint8_t _priority;
            Rectangular<uint32_t> _rectangular;
            Point<double> _position;
            ITexture _texture;
            std::string _tags;
        public:
            /* 公开属性 */
            bool visiable = true;
            uint8_t alpha = 0xff;

            /* 资源控制 */
            RenderableElement(ITexture, uint8_t priority = 255) noexcept;
            ~RenderableElement() noexcept;

            /* 渲染优先级 */
            bool operator<(const RenderableElement&) const noexcept;
            bool operator>(const RenderableElement&) const noexcept;
            bool operator==(const RenderableElement&) const noexcept;

            /* tag 控制 */
            bool hasTag(const std::string&) const noexcept;
            std::string getTags() const noexcept;
            void appendTag(const std::string&) noexcept;
            void cleanTags() noexcept;
    };
}

#endif

